<?php
/**
 * MessageHelper
 * - Helper class to show messages (e.g: error message)
 * - This is used for international purpose
 * @since version - Aug 04, 2011
 * $Id: $
 */

class MessageHelper {
	public $messageError = array();
	/**
     * init
     * - Constructor
     */
    public function __construct() {
    }
    /**
     * setError
     * - Set message error into $messageError
     * @param string $messError
     * @return void
     */
	public function setError($keyError, $messError) {
		$this->messageError[$keyError] = $messError;
	}
	/**
	 * showErrorMessage
	 * - Show the error messages in a yellow box
	 * @author Do Truong Giang
	 * @since 1.0 - Feb 6, 2009
	 * @param Array messages The array of error messages id
	 * @return String HTML string to show the messages in a yellow box
	 */
	public function showAllErrorMessage() {
		if (!empty($this->messageError)) {
			$html = "<div style='border: 2px solid #FF0000;background-color:#FFFFCC;font-size:100%;padding: 5px;margin:15px auto;width:70%;text-align:left;'>";
			$html .= "<span style='color:red;font-size:120%;font-weight:bold;padding-left:5px;text-align:left;'>エラー</span><br>";
			foreach ($this->messageError as $msgId) {
				$html .= "<span style=\"padding-left:20px;font-size:90%;text-align:left;\">" . $msgId . "</span><br>";
			}
			$html .= "</div>";
		}
		return isset($html) ? $html : null;
	}
}
?>